﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IterationLife.Domains.Sports.Models;
using IterationLife.Extensions.Extensions;

namespace IterationLife.Domains.Sports.Dtos.ZeppSports
{
    public class ZeppEvent
    {
        public string id { get; set; }
        public int sport { get; set; } //8才是足球数据
        public int gameType { get; set; } //1：团队比赛；2：个人比赛；3：训练
        public long startTime { get; set; }
        public long endTime { get; set; }
        public string location { get; set; }
        public ZeppTeam team { get; set; }
        public bool isLive { get; set; }
        public int durationTime { get; set; }
        public List<ZeppPlayerInfo> players { get; set; }

    }

    public static class ZeppEventExtension
    {
        public static SportEvent ToSportEvent(this ZeppEvent zeppEvent)
        {
            var result = new SportEvent(Guid.NewGuid());
            SetEntity(result, zeppEvent);
            return result;
        }

        public static void SetEntity(SportEvent sportEvent, ZeppEvent item)
        {
            sportEvent.PartnerEventId = item.id;
            sportEvent.EventType = item.gameType;
            sportEvent.StartTime = item.startTime.ToDateTime();
            sportEvent.EndTime = item.endTime.ToDateTime();
            sportEvent.FieldName = item.location;
        }
    }
}
